<template>
	<view>
		<view class="loginBg">
			<view class="headPic">
				<image src="../../static/logo.png" mode=""></image>
			</view>
		</view>
		<!-- 输入账号密码开始 -->
		<view class="submit">
			<view class="submitOne flx">
				<view class="icon">
					<i class="iconfont">&#xe768;</i>
				</view>
				<view class="txt">
					<input type="text" value="" v-model="phone"  placeholder="请输入手机号"/>
				</view>
			</view>
			<view class="submitOne flx">
				<view class="icon">
					<i class="iconfont">&#xe85a;</i>
				</view>
				<view class="txt">
					<input  type="password" value="" v-model="password"  placeholder="请输入密码"/>
				</view>
			</view>
		</view>
		<!-- 输入账号密码结束 -->
		<!-- 登录按钮开始 -->
		<view class="loginBtn">
			<button type="primary" class="" @click="login()">登录</button>
		</view>
		<!-- 登录按钮结束 -->
		<!-- 忘记密码开始 -->
		<view class="repass flx">
			<view class=" re repa" @click="openinfo('')">
				忘记密码
			</view>
			<view class="" @click="openinfo('../regist/regist')">
				注册账号
			</view>
		</view>
		<!-- 忘记密码结束 -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				phone:'',
				password:''
			};
		},
		onLoad(){
			console.log('加载触发')
		},
		methods:{
				//跳转页面
			 openinfo(url) {
			      
			      //var newsid = e.currentTarget.dataset.newsid ;    
			      uni.navigateTo({
			          url: url,
			          success: res => {},
			          fail: () => {},
			          complete: () => {}
			      });
			  },
			  login(){
				  /* uni.showToast({
				  	title: '用户不存在',
				  	duration: 2000
				  }); */
				  console.log(this.phone);
				  console.log(this.password);
				  var that =this;
				  uni.request({
				  	  url: '/CEB/login_login.action', 
					  method:"get",
						data: {
							phoneNum: that.phone,
							password: that.password
						},
						success:  (res)=> {
							console.log(res.data);
							if(res.data == 'success'){
								uni.switchTab({
								    url: "../home/home",
								    success: res => {},
								    fail: () => {},
								    complete: () => {}
								});
							}else if(res.data == 'isNotExist'){
								uni.showToast({
									title: '用户不存在',
									duration: 2000
								});
							}else if(res.data == 'pwdError'){
								uni.showToast({
									title: '密码错误',
									duration: 2000
								});
							}
							
                         }
				  })
			  }
		}
	}
</script>

<style>
.loginBg{
	width: 100%;
	height: 550rpx;
	background-image: url(../../static/loginBg.png);
	background-size: cover;
	position: relative;
}
.headPic{
	width: 150rpx;
	height: 150rpx;
	border-radius: 50%;
	box-shadow: 2rpx 2rpx 5rpx #8F8F94;
	position: absolute;
	top: 100rpx;
	left: 40%;
}
.headPic image{
	width: 100%;
	height: 100%;
	border-radius: 50%;
}
.submit{
	width: 90%;
	margin: 0 auto;
	margin-top: 30rpx;
}
.flx{
	display: flex;
	justify-content: flex-start;
}
.submitOne{
	border-bottom: 2rpx solid #F7F7F7;
	width: 100%;
	height: 120rpx;
	line-height: 120rpx;
}
.submitOne .iconfont{
	font-size: 38rpx;
	color: #FF542E;
}
.submitOne .txt{
	font-size: 30rpx;
	margin-left: 30rpx;
}
.submitOne .txt input{
	margin-top: 30rpx;
}
.loginBtn{
	width: 60%;
	margin: 0 auto;
	margin-top: 150rpx;
}
.loginBtn button{
	background: #FF542E;
	font-size: 36rpx;
	border-radius: 50rpx;
}
.repass{
	width: 280rpx;
	text-align: center;
	margin: 0 auto;
	margin-top: 20rpx;
	font-size: 30rpx;
}
.repass .repa{
   border-right: 2rpx solid #676767;
   margin-right: 6rpx;
}
.re{
	padding: 0 10rpx;
}
</style>
